
if (typeof jQuery !== 'undefined') {
    (function ($) {
              var options = {
            beforeSubmit: function showRequest() {
                var n = 0;
                $(".dataOracle").each(function () {
                    if ($(this).prop("checked")) {
                        n += 1;
                    }
                });
                if (n != 1) {
                    alert("请选择需要此项目是否启用或停用！");
                    return false;
                }else{ return true;}
            },

            success: function showResponse(responseText) {
                if (responseText == "1") {
                    alert('答题项目发现重名，请检查！!');
                    $('#dlg_xm').dialog('close');
                    return false;
                }
                if (responseText == "true") {
                    alert('答题项目添加成功!');
                    $('#dlg_xm').dialog('close');
                    document.location.reload();
                }
            }

        };
        $('#createXm').ajaxForm(options);
    })(jQuery);
}


$(document).ready(function(){
    var height1 = $(window).height()-10;
    $("#main_layout").attr("style","width:100%;height:"+height1+"px");
    $("#main_layout").layout("resize",{
        width:"100%",
        height:height1+"px"
    });
});



function addTab(title, url){
    if ($('#tt').tabs('exists', title)){
        $('#tt').tabs('select', title);
    } else {
        var content = '<iframe scrolling="auto" frameborder="0" src="'+url+'" style="width:99%;height:99%;"></iframe>';
        $('#tt').tabs('add',{
            title:title,
            content:content,
            closable:true
        });
    }
}

function denglu(){
var userName = $("#username").val();
    var passWord = $("#password").val();
    $.ajax({
        type: "POST",
        url: "signIn",
        cache: false,
        data: { username:userName, password: passWord, date: new Date()},
        async: false,
        success: function (msg) {
           if (msg == "false"){
               alert("用户名或密码错误！请重新输入！");
               return;
           }else{
               window.location.href="main";
           }
        }
    });

}

function dt_xm_gb(){
    $('#dlg_xm').dialog('close');
}
